﻿using System;
using System.Text;
using System.ServiceModel;
using System.ComponentModel;
using Sinacor.Infra.UI.Common;
using System.Collections.Generic;
using Sinacor.Infra.UI.Security.Services;
using Sinacor.UI.Bovespa.Corretagem.Communication.Bovespa.Acesso.Acesso;

namespace Sinacor.UI.Bovespa.Corretagem.Communication
{
    public class Accesso : BaseCommunication
    {
       #region Construtor

        public Accesso(SessionInformation sessionInformation)
            : base(sessionInformation)
        {
        }

        #endregion

        #region VerificarAcessoFuncao

        public bool VerificarAcessoFuncao(Model.Parameter.FiltroVerificarAcessoFuncao request)
        {
            IAcesso servico = null;
            bool retorno =false; 
            try
            {
                using (ServiceInstance<IAcesso> service = new ServiceInstance<IAcesso>())
                {
                    servico = service.TryGetInstance(this.Session);
                    retorno =  servico.VerificarAcessoFuncao(new Translator.ModelToDataContract.Acesso().ToVerificarAcessoFuncaoRequest(request));
                }
            }
            catch (Exception ex)
            {
                HandleFault(ex);
            }
            return retorno; 

        }

        #endregion
    }
}
